import {SimulationConfig, SimulationJobDefinition, SimulationRequestIn1} from "../common/simulator";
import {generateBusinessId, products} from "../common/util";
import * as _ from 'lodash';

export async function buildSimulationJobDefinition(product, simConfig?: SimulationConfig): Promise<SimulationJobDefinition> {
    const businessId = `${ simConfig?.businessId || generateBusinessId()}`;
    const def: SimulationJobDefinition = {
        product: product,
        businessId,
        desc: simConfig?.task?.desc || `${product} simulation: ${businessId}`,
        spec: {
            runMode: simConfig?.runMode || 'native',
            model: {
                type: simConfig?.model?.type || 'remote',
                file: simConfig?.model?.file || '',
                entry: simConfig?.model?.entry || ''
            },
            parameters: [],
            result: {
                ossPath: '',
                specifiedLocalPath: simConfig?.result?.nativePath || '',
                specifiedOutputParams: [],
                uploadRawSimResult: true
            },
            config: simConfig?.config || {},
            openGui: simConfig?.openGui || false,
            extendedProperty: simConfig?.extra || {}
        }
    };

    return def;
}